/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JFrameLogin1.java
 *
 * Created on Dec 9, 2011, 10:33:25 AM
 */
package callcenter;

import Database.*;
import java.awt.Color;
import java.awt.Font;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.border.TitledBorder;

/**
 *
 * @author user
 */
public class JFrameLogin1 extends javax.swing.JFrame {

    private File directory = new File(".");
    private Color cl = new Color(255, 255, 255);
    private Color color = new Color(234, 13, 0);
    public boolean kq;
    private String err;
    private String err1;
    private String err2;
    private String err3;
    private String langue = new String();
    private String country = new String();
    private String chuoi = new String();
    private Locale lc = null;
    private ResourceBundle rb = null;
    private File f = new File("."); 
    private String wa;

    /** Creates new form JFrameLogin1 */
    public JFrameLogin1() {
        initComponents();
        Medium.jf1 = this;
        //txtfield.setFont(new Font("Time New Romans", Font.BOLD, 15));
        jTextFieldUser.setFont(new Font("Andalus", Font.BOLD, 15));
        Translate("en", "English", "JFrameLogin1_en_US");
        String[] state = Read_State().split("/");
        if (state[0].equals("a")) {
            String[] arr = Read_info(state[1]).split("/");
            jTextFieldUser.setText(arr[0]);
            jPasswordFieldPass.setText(arr[1]);
            jCheckBoxrememberpass.setSelected(true);
        }

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel26 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jComboBoxLc = new javax.swing.JComboBox();
        jPanel27 = new javax.swing.JPanel();
        jPanel28 = new javax.swing.JPanel();
        jPanel29 = new javax.swing.JPanel();
        jPanel30 = new javax.swing.JPanel();
        jPanel31 = new javax.swing.JPanel();
        jPanel32 = new javax.swing.JPanel();
        jPanel33 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        jPanel12 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jPanel13 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jPanel14 = new javax.swing.JPanel();
        jPanel15 = new javax.swing.JPanel();
        jPanel16 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        jPanel18 = new javax.swing.JPanel();
        jTextFieldUser = new javax.swing.JTextField();
        jPanel19 = new javax.swing.JPanel();
        jPasswordFieldPass = new javax.swing.JPasswordField();
        jPanel21 = new javax.swing.JPanel();
        jCheckBoxrememberpass = new javax.swing.JCheckBox();
        jPanel22 = new javax.swing.JPanel();
        jPanel23 = new javax.swing.JPanel();
        jButtonSubmit = new javax.swing.JButton();
        jPanel24 = new javax.swing.JPanel();
        jPanel25 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jPanel34 = new javax.swing.JPanel();
        jPanel20 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(callcenter.CallcenterApp.class).getContext().getResourceMap(JFrameLogin1.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setName("Form"); // NOI18N
        setResizable(false);

        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setLayout(new java.awt.BorderLayout());

        jLabel1.setBackground(resourceMap.getColor("jLabel1.background")); // NOI18N
        jLabel1.setFont(resourceMap.getFont("jLabel1.font")); // NOI18N
        jLabel1.setForeground(resourceMap.getColor("jLabel1.foreground")); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N
        jLabel1.setOpaque(true);
        jLabel1.setPreferredSize(new java.awt.Dimension(137, 100));
        jPanel1.add(jLabel1, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_START);

        jPanel2.setName("jPanel2"); // NOI18N
        jPanel2.setLayout(new java.awt.BorderLayout());

        jPanel3.setName("jPanel3"); // NOI18N
        jPanel3.setPreferredSize(new java.awt.Dimension(70, 284));

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 70, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 241, Short.MAX_VALUE)
        );

        jPanel2.add(jPanel3, java.awt.BorderLayout.LINE_START);

        jPanel4.setName("jPanel4"); // NOI18N
        jPanel4.setPreferredSize(new java.awt.Dimension(110, 284));
        jPanel4.setLayout(new java.awt.GridLayout(8, 1, 3, 3));

        jPanel26.setName("jPanel26"); // NOI18N
        jPanel26.setLayout(new java.awt.BorderLayout());

        jLabel4.setForeground(resourceMap.getColor("jLabel4.foreground")); // NOI18N
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N
        jPanel26.add(jLabel4, java.awt.BorderLayout.PAGE_START);

        jComboBoxLc.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "English", "Viet Nam" }));
        jComboBoxLc.setName("jComboBoxLc"); // NOI18N
        jComboBoxLc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxLcActionPerformed(evt);
            }
        });
        jPanel26.add(jComboBoxLc, java.awt.BorderLayout.CENTER);

        jPanel4.add(jPanel26);

        jPanel27.setName("jPanel27"); // NOI18N

        javax.swing.GroupLayout jPanel27Layout = new javax.swing.GroupLayout(jPanel27);
        jPanel27.setLayout(jPanel27Layout);
        jPanel27Layout.setHorizontalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel27Layout.setVerticalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 27, Short.MAX_VALUE)
        );

        jPanel4.add(jPanel27);

        jPanel28.setName("jPanel28"); // NOI18N

        javax.swing.GroupLayout jPanel28Layout = new javax.swing.GroupLayout(jPanel28);
        jPanel28.setLayout(jPanel28Layout);
        jPanel28Layout.setHorizontalGroup(
            jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel28Layout.setVerticalGroup(
            jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 27, Short.MAX_VALUE)
        );

        jPanel4.add(jPanel28);

        jPanel29.setName("jPanel29"); // NOI18N

        javax.swing.GroupLayout jPanel29Layout = new javax.swing.GroupLayout(jPanel29);
        jPanel29.setLayout(jPanel29Layout);
        jPanel29Layout.setHorizontalGroup(
            jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel29Layout.setVerticalGroup(
            jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 27, Short.MAX_VALUE)
        );

        jPanel4.add(jPanel29);

        jPanel30.setName("jPanel30"); // NOI18N

        javax.swing.GroupLayout jPanel30Layout = new javax.swing.GroupLayout(jPanel30);
        jPanel30.setLayout(jPanel30Layout);
        jPanel30Layout.setHorizontalGroup(
            jPanel30Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel30Layout.setVerticalGroup(
            jPanel30Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 27, Short.MAX_VALUE)
        );

        jPanel4.add(jPanel30);

        jPanel31.setName("jPanel31"); // NOI18N

        javax.swing.GroupLayout jPanel31Layout = new javax.swing.GroupLayout(jPanel31);
        jPanel31.setLayout(jPanel31Layout);
        jPanel31Layout.setHorizontalGroup(
            jPanel31Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel31Layout.setVerticalGroup(
            jPanel31Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 27, Short.MAX_VALUE)
        );

        jPanel4.add(jPanel31);

        jPanel32.setName("jPanel32"); // NOI18N

        javax.swing.GroupLayout jPanel32Layout = new javax.swing.GroupLayout(jPanel32);
        jPanel32.setLayout(jPanel32Layout);
        jPanel32Layout.setHorizontalGroup(
            jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel32Layout.setVerticalGroup(
            jPanel32Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 27, Short.MAX_VALUE)
        );

        jPanel4.add(jPanel32);

        jPanel33.setName("jPanel33"); // NOI18N

        javax.swing.GroupLayout jPanel33Layout = new javax.swing.GroupLayout(jPanel33);
        jPanel33.setLayout(jPanel33Layout);
        jPanel33Layout.setHorizontalGroup(
            jPanel33Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel33Layout.setVerticalGroup(
            jPanel33Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 27, Short.MAX_VALUE)
        );

        jPanel4.add(jPanel33);

        jPanel2.add(jPanel4, java.awt.BorderLayout.LINE_END);

        jPanel5.setName("jPanel5"); // NOI18N
        jPanel5.setLayout(new java.awt.BorderLayout());

        jPanel6.setName("jPanel6"); // NOI18N
        jPanel6.setPreferredSize(new java.awt.Dimension(339, 40));

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 313, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 40, Short.MAX_VALUE)
        );

        jPanel5.add(jPanel6, java.awt.BorderLayout.PAGE_START);

        jPanel7.setName("jPanel7"); // NOI18N
        jPanel7.setPreferredSize(new java.awt.Dimension(339, 50));

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 313, Short.MAX_VALUE)
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 50, Short.MAX_VALUE)
        );

        jPanel5.add(jPanel7, java.awt.BorderLayout.PAGE_END);

        jPanel8.setName("jPanel8"); // NOI18N
        jPanel8.setLayout(new java.awt.BorderLayout());

        jPanel9.setName("jPanel9"); // NOI18N
        jPanel9.setLayout(new java.awt.GridLayout(6, 1, 3, 3));

        jPanel11.setName("jPanel11"); // NOI18N
        jPanel11.setLayout(new java.awt.BorderLayout());
        jPanel9.add(jPanel11);

        jPanel12.setName("jPanel12"); // NOI18N
        jPanel12.setLayout(new java.awt.BorderLayout());

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N
        jPanel12.add(jLabel2, java.awt.BorderLayout.CENTER);

        jPanel9.add(jPanel12);

        jPanel13.setName("jPanel13"); // NOI18N
        jPanel13.setLayout(new java.awt.BorderLayout());

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N
        jPanel13.add(jLabel3, java.awt.BorderLayout.CENTER);

        jPanel9.add(jPanel13);

        jPanel14.setName("jPanel14"); // NOI18N

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 22, Short.MAX_VALUE)
        );

        jPanel9.add(jPanel14);

        jPanel15.setName("jPanel15"); // NOI18N

        javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
        jPanel15.setLayout(jPanel15Layout);
        jPanel15Layout.setHorizontalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel15Layout.setVerticalGroup(
            jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 22, Short.MAX_VALUE)
        );

        jPanel9.add(jPanel15);

        jPanel16.setName("jPanel16"); // NOI18N

        javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
        jPanel16.setLayout(jPanel16Layout);
        jPanel16Layout.setHorizontalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel16Layout.setVerticalGroup(
            jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 22, Short.MAX_VALUE)
        );

        jPanel9.add(jPanel16);

        jPanel8.add(jPanel9, java.awt.BorderLayout.LINE_START);

        jPanel10.setName("jPanel10"); // NOI18N
        jPanel10.setLayout(new java.awt.GridLayout(6, 1, 3, 3));

        jPanel17.setName("jPanel17"); // NOI18N
        jPanel17.setLayout(new java.awt.BorderLayout());
        jPanel10.add(jPanel17);

        jPanel18.setName("jPanel18"); // NOI18N
        jPanel18.setLayout(new java.awt.BorderLayout());

        jTextFieldUser.setText(resourceMap.getString("jTextFieldUser.text")); // NOI18N
        jTextFieldUser.setName("jTextFieldUser"); // NOI18N
        jTextFieldUser.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTextFieldUserMouseClicked(evt);
            }
        });
        jTextFieldUser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextFieldUserActionPerformed(evt);
            }
        });
        jPanel18.add(jTextFieldUser, java.awt.BorderLayout.CENTER);

        jPanel10.add(jPanel18);

        jPanel19.setName("jPanel19"); // NOI18N
        jPanel19.setLayout(new java.awt.BorderLayout());

        jPasswordFieldPass.setText(resourceMap.getString("jPasswordFieldPass.text")); // NOI18N
        jPasswordFieldPass.setName("jPasswordFieldPass"); // NOI18N
        jPasswordFieldPass.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jPasswordFieldPassMouseClicked(evt);
            }
        });
        jPanel19.add(jPasswordFieldPass, java.awt.BorderLayout.CENTER);

        jPanel10.add(jPanel19);

        jPanel21.setName("jPanel21"); // NOI18N
        jPanel21.setLayout(new java.awt.BorderLayout());

        jCheckBoxrememberpass.setText(resourceMap.getString("jCheckBoxrememberpass.text")); // NOI18N
        jCheckBoxrememberpass.setName("jCheckBoxrememberpass"); // NOI18N
        jPanel21.add(jCheckBoxrememberpass, java.awt.BorderLayout.CENTER);

        jPanel10.add(jPanel21);

        jPanel22.setName("jPanel22"); // NOI18N
        jPanel22.setLayout(new java.awt.BorderLayout());

        jPanel23.setName("jPanel23"); // NOI18N
        jPanel23.setPreferredSize(new java.awt.Dimension(101, 31));
        jPanel23.setLayout(new java.awt.BorderLayout());

        jButtonSubmit.setIcon(resourceMap.getIcon("jButtonSubmit.icon")); // NOI18N
        jButtonSubmit.setText(resourceMap.getString("jButtonSubmit.text")); // NOI18N
        jButtonSubmit.setName("jButtonSubmit"); // NOI18N
        jButtonSubmit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSubmitActionPerformed(evt);
            }
        });
        jPanel23.add(jButtonSubmit, java.awt.BorderLayout.CENTER);

        jPanel22.add(jPanel23, java.awt.BorderLayout.LINE_START);

        jPanel24.setName("jPanel24"); // NOI18N
        jPanel24.setLayout(new java.awt.BorderLayout());

        jPanel25.setName("jPanel25"); // NOI18N
        jPanel25.setPreferredSize(new java.awt.Dimension(101, 31));
        jPanel25.setLayout(new java.awt.BorderLayout());

        jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel25.add(jButton1, java.awt.BorderLayout.CENTER);

        jPanel24.add(jPanel25, java.awt.BorderLayout.LINE_END);

        jPanel34.setName("jPanel34"); // NOI18N
        jPanel34.setPreferredSize(new java.awt.Dimension(27, 31));

        javax.swing.GroupLayout jPanel34Layout = new javax.swing.GroupLayout(jPanel34);
        jPanel34.setLayout(jPanel34Layout);
        jPanel34Layout.setHorizontalGroup(
            jPanel34Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 27, Short.MAX_VALUE)
        );
        jPanel34Layout.setVerticalGroup(
            jPanel34Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 22, Short.MAX_VALUE)
        );

        jPanel24.add(jPanel34, java.awt.BorderLayout.LINE_START);

        jPanel22.add(jPanel24, java.awt.BorderLayout.CENTER);

        jPanel10.add(jPanel22);

        jPanel20.setName("jPanel20"); // NOI18N

        javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20);
        jPanel20.setLayout(jPanel20Layout);
        jPanel20Layout.setHorizontalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 203, Short.MAX_VALUE)
        );
        jPanel20Layout.setVerticalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 22, Short.MAX_VALUE)
        );

        jPanel10.add(jPanel20);

        jPanel8.add(jPanel10, java.awt.BorderLayout.CENTER);

        jPanel5.add(jPanel8, java.awt.BorderLayout.CENTER);

        jPanel2.add(jPanel5, java.awt.BorderLayout.CENTER);

        getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    public void Translate(String langue, String tenqg, String chuoi) {
        //callcenter/resources/JEnglishEnglish
        lc = new Locale(langue, tenqg);
        rb = ResourceBundle.getBundle("callcenter/resources/" + chuoi, lc);
        jLabel1.setText(rb.getString("jLabel1.text"));
        jLabel2.setText(rb.getString("jLabel2.text"));
        jLabel3.setText(rb.getString("jLabel3.text"));
        jLabel4.setText(rb.getString("jLabel4.text"));
        jButton1.setText(rb.getString("jButton1.text"));
        jButtonSubmit.setText(rb.getString("jButtonSubmit.text"));
        err = rb.getString("err");
        err1 = rb.getString("err1");
        err2 = rb.getString("err2");
        err3 = rb.getString("err3");
//        wa = rb.getString("wa");

    }
    private void jButtonSubmitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSubmitActionPerformed

        Administative ad = new Administative();
        ad = ad.Login(jTextFieldUser.getText(), jPasswordFieldPass.getText());
        if (jTextFieldUser.getText().equals("")) {
            if (jPasswordFieldPass.getText().equals("")) {

                jTextFieldUser.setBackground(color);
                jPasswordFieldPass.setBackground(color);
                try {
                    ImageIcon iic = new ImageIcon(f.getCanonicalPath()+"\\src\\callcenter\\resources\\Images\\war.png");
                    JOptionPane.showMessageDialog(null, err, wa, 0, iic);
                } catch (Exception e) {
                }
            } else if (jPasswordFieldPass.getText() != null) {
                try {
                    ImageIcon iic = new ImageIcon(f.getCanonicalPath()+"\\src\\callcenter\\resources\\Images\\war.png");
                    JOptionPane.showMessageDialog(null, err1, wa, 0, iic);
                           
                } catch (Exception e) {
                }
                jTextFieldUser.setBackground(color);
            }

        } else if (jPasswordFieldPass.getText().equals("")) {
            //jPasswordFieldPass.setForeground(color);
            try {
                ImageIcon iic = new ImageIcon(f.getCanonicalPath()+"\\src\\callcenter\\resources\\Images\\war.png");
                JOptionPane.showMessageDialog(null, err2, wa, 0, iic);
                jPasswordFieldPass.setBackground(color);
                
            } catch (Exception e) {
            }
        } else {
            if (ad == null) {
                try {
                    
                    ImageIcon iic = new ImageIcon(f.getCanonicalPath()+"\\src\\callcenter\\resources\\Images\\login.png");
                    JOptionPane.showMessageDialog(null, err3, wa, 0, iic);
                } catch (Exception e) {
                }
                
            } else {

                if (jCheckBoxrememberpass.isSelected()) {

                    State("a/" + jTextFieldUser.getText());
                    Write_info(jTextFieldUser.getText(), jPasswordFieldPass.getText());
                } else {
                    State("b/kav");
                }
                Medium.jfm = new JFrameMain();
                Medium.jfm.setVisible(true);
                Medium.jf1.dispose();
            }
        }
    }//GEN-LAST:event_jButtonSubmitActionPerformed

    public  void State(String a) {
        try {
            FileOutputStream fos = new FileOutputStream(directory.getCanonicalPath() + "\\src\\callcenter\\resources\\info\\state.txt");
            fos.write(a.getBytes());
            fos.flush();
            fos.close();

        } catch (Exception ex) {
            System.out.println(ex);
        }
    }

    private void Write_info(String user, String pass) {
        try {
            FileOutputStream fos = new FileOutputStream(directory.getCanonicalPath() + "\\src\\callcenter\\resources\\info\\" + user + ".txt");
            fos.write((user + "/" + pass).getBytes());
            fos.flush();
            fos.close();

        } catch (Exception ex) {
            System.out.println(ex);


        }

    }

    public String Read_State() {
        String chuoi = new String();
        char b = 0;
        char[] c = null;
        int dem = 0;
        try {
            InputStream is = new FileInputStream(directory.getCanonicalPath() + "\\src\\callcenter\\resources\\info\\state.txt");
            int ch;
            while ((ch = is.read()) != -1) {
                b = (char) ch;
                chuoi += Character.valueOf(b);
            }
            is.close();

        } catch (Exception ex) {
            System.out.println(ex);
        }
        return chuoi;

    }

    public String Read_info(String a) {
        String chuoi = new String();
        char b = 0;
        try {
            InputStream is = new FileInputStream(directory.getCanonicalPath() + "\\src\\callcenter\\resources\\info\\" + a + ".txt");
            int ch;
            while ((ch = is.read()) != -1) {
                b = (char) ch;
                chuoi += Character.valueOf(b);
            }
            is.close();

        } catch (Exception ex) {
            System.out.println(ex);
        }
        return chuoi;
    }
    
    public String Information()
    {
        String kq = new String();
        Administative ad = new Administative();
        ad = ad.Login(jTextFieldUser.getText(), jPasswordFieldPass.getText());
        kq += (ad.getUserName()+"/"+ad.getPassWord()+"/"+ad.getAccountName()+"/"+ad.getAddress()+"/"+ad.getEmail()+"/"+ad.getPhone()) ;
        return  kq;
    }
    private void jTextFieldUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldUserActionPerformed
        // TODO add your handling code here:\
        JOptionPane.showMessageDialog(null, "click");
    }//GEN-LAST:event_jTextFieldUserActionPerformed

    private void jTextFieldUserMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextFieldUserMouseClicked
        // TODO add your handling code here:

        jTextFieldUser.setBackground(cl);
        // JOptionPane.showMessageDialog(null, "click");

    }//GEN-LAST:event_jTextFieldUserMouseClicked

    private void jPasswordFieldPassMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPasswordFieldPassMouseClicked
        // TODO add your handling code here:\
        jPasswordFieldPass.setBackground(cl);
    }//GEN-LAST:event_jPasswordFieldPassMouseClicked

    private void jComboBoxLcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxLcActionPerformed
        // TODO add your handling code here:
        if (jComboBoxLc.getSelectedIndex() == 0) {
            //callcenter/resources/JFrameLogin1_en_US
            Translate("en", "English", "JFrameLogin1_en_US");
        } else {
            Translate("vi", "Vietnamese", "JFrameLogin1_vi_VN");
        }
    }//GEN-LAST:event_jComboBoxLcActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:

        jTextFieldUser.setText("");
        jPasswordFieldPass.setText("");
        jTextFieldUser.setBackground(cl);
        jPasswordFieldPass.setBackground(cl);
        jCheckBoxrememberpass.setSelected(false);
    }//GEN-LAST:event_jButton1ActionPerformed

    public boolean Takeon() {
        return kq;
    }

    public int KQ() {
        return jComboBoxLc.getSelectedIndex();
    }

    public String Greetings() {
        Administative ad = new Administative();
        ad = ad.Login(jTextFieldUser.getText(), jPasswordFieldPass.getText());
        return ad.getAccountName();
    }

    public String Autho() {
        Administative ad = new Administative();
        ad = ad.Login(jTextFieldUser.getText(), jPasswordFieldPass.getText());
        return ad.getAuthority();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new JFrameLogin1().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButtonSubmit;
    private javax.swing.JCheckBox jCheckBoxrememberpass;
    private javax.swing.JComboBox jComboBoxLc;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel28;
    private javax.swing.JPanel jPanel29;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel30;
    private javax.swing.JPanel jPanel31;
    private javax.swing.JPanel jPanel32;
    private javax.swing.JPanel jPanel33;
    private javax.swing.JPanel jPanel34;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPasswordField jPasswordFieldPass;
    private javax.swing.JTextField jTextFieldUser;
    // End of variables declaration//GEN-END:variables
}
